//
//  VisitorView.swift
//  Sina
//
//  Created by 袁量 on 2016/11/29.
//  Copyright © 2016年 袁量. All rights reserved.
//

import UIKit

class VisitorView: UIView {
    
    
    
    
    @IBOutlet var registerButton: UIButton!
    
    @IBOutlet var logoInButton: UIButton!
    @IBOutlet var rotationImageView: UIImageView!
    @IBOutlet var iconImageView: UIImageView!
    @IBOutlet var titleLabel: UILabel!
}
extension VisitorView{
    func setupVisitorInfo(imageName: String?, title: String)
    {
        titleLabel.text = title
        guard let name = imageName else
        {
            WWLog(mesage: "首页")
            return
        }
        iconImageView.image = UIImage(named: name)
        
    }
    // 加载  XIB
    class func visitorView() -> VisitorView
    {
        return Bundle.main.loadNibNamed("VisitorView", owner: nil, options: nil)?.first as! VisitorView
    }
    func startAniamtion()
    {
        let anim = CABasicAnimation(keyPath: "transform.rotation")
        //        anim.toValue = 2 * M_PI
        anim.toValue = Double.pi * 2
        anim.duration = 5.0
        anim.repeatCount = MAXFLOAT
        anim.isRemovedOnCompletion = false //当控制器完全消失的时候，动画不被移除
        
        rotationImageView.layer.add(anim, forKey: nil)
    }

}

